package com.qiwx.pigeon.base;

import android.content.Context;
import android.os.Bundle;

import androidx.annotation.Nullable;

/**
 * @description
 * @Author qiwx
 * @Date 2020-04-16 14:58
 **/
public abstract class BaseMVPActivity<V extends IBaseView, T extends BasePresenter<V>> extends BaseActivity {
    protected T mPresenter;
    public Context context;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        mPresenter = createPresenter();
        super.onCreate(savedInstanceState);
        context = this;
    }

    public abstract T createPresenter();

    @Override
    protected void onDestroy() {
        if (mPresenter != null) {
            mPresenter.detachView();
        }
        super.onDestroy();
    }
}
